#include <Upgrade.h>



void Upgrade(QString ID)
{
    int rand;
    int Level;
    QString Select=QString("select 圣遗物副词条1, 圣遗物副词条2,圣遗物副词条3,圣遗物副词条4,副词条数值1,副词条数值2,副词条数值3,副词条数值4, 等级 from List where 标识码 = '%1'").arg(ID);
    QSqlQuery Query;
    Query.exec(Select);
    Query.next();
    if(Query.value(7).toFloat()==0){
        rand=3;
    }else{
        rand = QRandomGenerator::global()->generate()%4;
    }
    QString tmpString="副词条数值"+QString::number(rand+1);
    QString SubStrTp= Query.value(rand).toString();
    float ValueBefore=Query.value(rand+4).toFloat();
    Level=Query.value(8).toInt();
    float ValueNew=ValueBefore+ReadGrowth(SubStrTp);
    Level=Level+4;
    QString Update=QString("UPDATE List SET %1 = '%2',等级 = '%3' WHERE 标识码 = '%4'").arg(tmpString).arg(ValueNew).arg(Level).arg(ID);
    Query.exec(Update);

}
